﻿#pragma once
#include<iostream>
#include<stdio.h>
#include<assert.h>
#include"myrbtree.h"
using namespace std;

template<class T>
class Set
{
public:
	struct KoT
	{
		const T& operator()(const T& t)
		{
			return t;
		}
	};

	typedef typename RBTree<T, const T, KoT>::Iterator iterator;
	typedef typename RBTree<T, const T, KoT>::ConstIterator const_iterator;

	iterator begin()
	{
		return _tree.Begin();
	}

	iterator end()
	{
		return _tree.End();
	}

	const_iterator cbegin() const
	{
		return _tree.Begin();
	}
	const_iterator cend() const
	{
		return _tree.End();
	}

	pair<iterator, bool> insert(const T& key)
	{
		return _tree.Insert(key);
	}

	iterator find(const T& key)
	{
		return _tree.Find(key);
	}

	void Print(const Set<int>& s)
	{
		Set<int>::const_iterator it = s.cbegin();
		while (it != s.cend())
		{
			++it;
			cout << *it << " ";
		}
		cout << endl;
	}

private:
	RBTree<T, const T, KoT> _tree;

};
